/**
 * @ProjectName: p2p_core_sina 
 * @Copyright: Copyright (c) 2016, qudoulicai All Rights Reserved. 
 * @address: Hangzhou City, Zhejiang Province, China
 * @date: 2016年2月3日 下午8:16:41
 * @Description: 
 */
package com.qdlc.p2p.biz.processor.task;


import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.processor.event.BorrowValueEvent;
import com.qdlc.p2p.biz.service.borrow.BorrowFullVerifyService;
import com.qdlc.p2p.common.core.queue.TaskProcessorException;
import com.qdlc.p2p.common.core.queue.ValueEvent;
import com.qdlc.p2p.dal.model.BorrowModel;

/**
 * <p>满标复审失败任务处理类</p>
 * @author Kaiju Zhao 2016年2月3日 下午8:16:25
 * @version V1.0   
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify by user: {修改人} 2016年2月3日 下午8:16:25
 * @modify by reason:{原因}
 */
@Service
public class VerifyFullFailTaskProcessor extends AbstractVerifyBorrowTaskProcessor {

	private static final Logger logger = Logger.getLogger(VerifyFullFailTaskProcessor.class);

	@Resource
	BorrowFullVerifyService borrowFullVerifyService;

	@Override
	public boolean supports(ValueEvent event) {
		return event instanceof BorrowValueEvent;
	}

	@Override
	protected void process0(ValueEvent event) throws TaskProcessorException {
		BorrowValueEvent borrowEvent = (BorrowValueEvent)event;
		BorrowModel borrowModel = borrowEvent.getBorrowModel();
		logger.info("++++ 满标复审不通过,开始异步处理业务逻辑,borrowId:"+ borrowModel.getId());
		try {
			borrowFullVerifyService.verifyFullFail(borrowModel);
        } catch (Exception e) {
            logger.error("++++ 满标复审不通过,进入异步处理业务逻辑异常,borrowId:"+ borrowModel.getId());
            throw new TaskProcessorException(borrowEvent, e);
        }
	}
}
